<%= head_template(config, node.title, false) %>
<%= sidebar_template(config, node.type) %>

<div id="top-content">
  <div class="heading-with-actions top-heading">
    <h1><%= ExDoc.DocAST.to_string(node.title_doc) %></h1>
    <%= if node.type == :cheatmd do %>
      <button onclick="window.print()" title="Print Cheatsheet" class="icon-action" rel="print">
        <i class="ri-printer-line" aria-hidden="true"></i>
        <span class="sr-only">Print Cheatsheet</span>
      </button>
    <% end %>
    <%= if node.source_url do %>
      <a href="<%= node.source_url %>" title="View Source" class="icon-action" rel="help">
        <i class="ri-code-s-slash-line" aria-hidden="true"></i>
        <span class="sr-only">View Source</span>
      </a>
    <% end %>
  </div>

  <%= if node.type == :livemd do %>
    <div class="livebook-badge-container">
      <a href="#" class="livebook-badge">
        <img src="https://livebook.dev/badge/v1/blue.svg" alt="Run in Livebook" width="150" />
      </a>
    </div>
  <% end %>

  <%= if node.type == :cheatmd do %>
    <%= node.doc |> ExDoc.DocAST.sectionize([:h2, :h3]) |> render_doc() %>
  <% else %>
    <%= node[:content] || render_doc(node.doc) %>
  <% end %>
</div>

<div class="bottom-actions" id="bottom-actions">
  <div class="bottom-actions-item">
    <%= if refs.prev do %>
      <a href="<%= refs.prev.path %>" class="bottom-actions-button" rel="prev">
        <span class="subheader">
          ← Previous Page
        </span>
        <span class="title">
          <%= refs.prev.title %>
        </span>
      </a>
    <% end %>
  </div>
  <div class="bottom-actions-item">
    <%= if refs.next do %>
      <a href="<%= refs.next.path %>" class="bottom-actions-button" rel="next">
        <span class="subheader">
          Next Page →
        </span>
        <span class="title">
          <%= refs.next.title %>
        </span>
      </a>
    <% end %>
  </div>
</div>

<%= footer_template(config, node.source_path) %>
